package com.zlsy.springbootdemo.mt.enums;

import com.zlsy.springbootdemo.mt.reward.NewUserRewardStrategyA;
import com.zlsy.springbootdemo.mt.reward.OldUserRewardStrategyA;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author zhouliang
 * @date 2021/1/22 16:29
 */
@Getter
@AllArgsConstructor
public enum UserEnums {
  /** test */
  NEW_USER(1, NewUserRewardStrategyA.class),
  OLD_USER(2, OldUserRewardStrategyA.class);
  private Integer type;
  private Class c;

  public static UserEnums getInstance(Integer type) {
    return Arrays.stream(values())
        .filter(value -> value.type.equals(type))
        .findFirst()
        .orElse(null);
  }
}
